package com.iot.mongo.entity;

import lombok.Data;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;

import java.util.List;
import java.util.Map;

/**
 * 描述：
 *
 * @author: ruikanwang
 * @date: 2017/11/16 0016 13:02
 * @version: V1.0
 * 注意：本内容仅限于新疆感知科技有限公司内部传阅,禁止外泄以及用于其他的商业目
 * Copyright © 2018-ganinfo. All rights reserved.
 */
@Data
public class Page extends PageRequest {
    public Page(int page, int size) {
        super(page, size);
    }
    public Page(int page, int size, Sort sort) {
        super(page, size, sort);
    }
    private List<?> listData;//实体封装数据
    // 数据
    private List<Map<String, Object>> results;
    // 总页数
    private Long pageCount = 0L;
    // 总条数
    private Long totalCount = 0L;

    public void setTotalCount(Long totalCount) {
        if(totalCount%getPageSize()==0){
            this.pageCount=totalCount/getPageSize();
        }else{
            this.pageCount=totalCount/getPageSize()+1;
        }
        this.totalCount = totalCount;
    }
}
